[b][size=150]MISI[/size][/b]
[color=grey]Library for executing custom scripts[/color]
[img]http://gtamp.com/forum/download/file.php?mode=view&id=1809&sid=7e1ace83a7c0d6a2b64da5f139b03d6d[/img]

[color=black][b]Version:[/b][/color] v0.2b
[color=black][b]Release:[/b][/color] 24 feb 2018 
[color=black][b]Author:[/b][/color] DenLover (aka Logofero)

[size=120][b]License:[/b][/size]
[list]This library (hereinafter "application") is distributed by
license (EULA) free software "as is"
without any guarantees. The text of the license is inside
archive. The source code of this application is closed, but third-party
libraries are integrated/or linked in unchanged
You can find all the source resources on them in the archive.
All licenses for used software are also in
attached file.[/list]

[size=120][b]What is it?[/b][/size]
[list]Library for running LUA scripts in GTA2.
The library is loaded at the start of the game and gives you access
to the game world (as much as the author knows
useful addresses in the memory of the game).

The name MISI came to
me from the derived word of the initial scripts * .MIS
(which in translation probably means a mission) and together with
extension ASI (which is used in the game) it turned out
quite in tune with MISI.ASI.[/list]
           
[size=120][b]Example:[/b][/size]
            
[list]
scripts/[b]gamemode.txt[/b]
[code]-- *** Example test gamemode ***
-- Demonstration: change of player's position 1 (respawn), change skin, model, set max. running speed, save current coordinates in the log
-- Press key HOME (numpad), the player searches for the player at number 2 and changes his skin and teleports to the player at number 1

local gamestate = 0
local respawn = 0
local died = 0

function IsPedAlive(ped)
	if (ped ~= 0) then
		return true
	end
	return false
end

function IsPedInCar(ped)
	local car = GetPedCar(ped)
	if (car ~= 0) then
		return true
	end
	return false
end

function OnPedNewGame(ped)
	local player = GetPlayerStruct(ped)
	SetPlayerGameCam(player, 93,92,1)
	SetPlayerArmour(player, 200)
	SetPedHealth(ped, 200)
	SetPedPos(ped, 93,92,2)
	SetPedAngle(ped, 90)
	SetPedMaxSpeed(ped, 1024 + 128)
	SetPedSkin(ped, 0)
	SetPedModel(ped, 2)
	gamestate = 1
	respawn = 1
	WriteInLog(string.format("New game is started.\n" ))
end

function OnPedSpawn(ped)
	local player = GetPlayerStruct(ped)
	SetPlayerGameCam(player, 93,92,1)
	SetPedPos(ped, 93,92,2)
	SetPedAngle(ped, 90)
	SetPedMaxSpeed(ped, 1024 + 128)
	SetPedSkin(ped, 1)
	SetPedModel(ped, 2)
	respawn = 1
	died = 0
	WriteInLog(string.format("Player is spawned.\n" ))
end

function OnPedDied(ped)
	respawn = 0
	died = 1
	WriteInLog(string.format("Player is died.\n" ))	
end

while(true) do
	if (GetGameFrame() > 0) then
		local ped = GetPedStruct(1)
		if (IsPedAlive(ped)) then
			if (died == 0 and GetPedTask(ped) == 9) then
				OnPedDied(ped)
			end
			local player = GetPlayerStruct(ped)
			if (GetPedHealth(ped) <= 0 and gamestate > 0) then
				SetPedTask(ped, 9)
			end
			if (gamestate == 0 and GetPedHealth(ped) > 0 and GetPedTask(ped) == 7) then
				OnPedNewGame(ped)
			end
			if (respawn == 0 and GetPedHealth(ped) > 0 and GetPedTask(ped) == 7) then
				OnPedSpawn(ped)
			end
			if (IsPedInCar(ped)) then
				local car = GetPedCar(ped)
				local x, y, z = GetCarPos(car)
				--WriteInLog(string.format("In car id %d: damage %d struct %X pos %.01f %.01f %.01f rot %.01f\n", GetCarID(car), GetCarDamage(car), car, x,y,z, GetCarAngle(car)))
			else
				if (IsGameKeyPress(player, 0x74)) then
					local targetped = GetPedStruct(2)
					local targetpedplayer = GetPlayerStruct(targetped)
					local x,y,z = GetPedPos(ped)
					SetPlayerGameCam(targetpedplayer, x,y,z)
					SetPlayerWeaponSlot(targetpedplayer, 0)
					SetPedPos(targetped, x,y,z + 1)
					SetPedAngle(targetped, GetPedAngle(ped))
					SetPedMaxSpeed(targetped, 512)
					SetPedModel(targetped, 2)
					SetPedSkin(targetped, 25)
				end
				if (IsGameKeyPress(player, 0x86)) then
					SetPedHealth(ped, 0)
				end
				local x,y,z = GetPedPos(ped)
				--WriteInLog(string.format("In foot id %d: %X skin %d model %d health %.01f spec %d pos %.01f %.01f %.01f rot %.01f\n", GetPedID(ped), ped, GetPedSkin(ped), GetPedModel(ped), GetPedHealth(ped), GetPedSpecMode(ped), x,y,z, GetPedAngle(ped)))
			end					
		else
			gamestate = 0
			respawn = 0	
		end
	else
		gamestate = 0
		respawn = 0	
		WriteInLog(string.format("No game frame...\n" ))
	end
	wait(200)
end[/code]
scripts/[b]messagesound.txt[/b]
[code]-- *** Example play message sound ***
-- Since: v0.2b
-- For play down key SPACE
local address = 6168620
while(true) do
	if (IsKeyDown(32)) then
		WriteProcessMemory(address, 62, 4)
	end
	wait(200)
end
[/code]
[/list]
            
[size=120][b]Installation:[/b][/size]
[list]
* Requires the installed game [b]GTA2 v11.44[/b]

1. Run the installer misi_setup.exe
2. Select the installer language
3. Read and accept the license agreement
4. Select the root directory of the game
5. Select components to install
6. Confirm the installation
7. Installation complete
[/list]

[size=120][b]What is this for?[/b][/size]
[list]
            For easy and
quick creation/editing of game missions, trainers.
Thanks to the simple LUA syntax, anyone can use it
To study and write the unpretentious script for GTA2 without spending
thus it is a lot of time. It is enough to install MISI in the game,
create a text * .TXT or * .LUA file (name it as
wish), throw in the root folder script located
in the root directory of the game (where gta2.exe is located),
After that, you can run the game and enjoy your
creation.
[/list]

[size=120][b]History of changes:[/b][/size]
[list]
[b]v0.1, 25 jan 2018[/b] 
* Start MISI project       
* Head developing and testing time...          
* Integrated library LUA 5.3.4         
* Writen documentation

[b]v0.1a, 12 feb 2018[/b] 
[color=grey]Checksum MD5 fb67add3e1017bc64802b83da250dc25 MISI.ASI[/color]
* First alpha version.

[b]v0.2b[/b]    
[color=grey]Checksum MD5 34cb3cbb1167ed73b5278285803101e1 MISI.ASI[/color]              
* All methods are rewritten. 
* Fixed bugs in methods.
* Added new methods.
* Improved stability. 
* Removed (from MISI.log) debugging information about the thread number.
* Added info "Virtual key codes" in MISI/vk_codes.inc
* Added info "Game key codes" in MISI/gk_codes.inc
* The way of working with as an object (ped, player, car).
* New system of structures. All method GET/SET "Player" rename to "Ped".
* Added method GET ped struct of ID. Limit: 1 to 65535.
* Now if the ReadProcessMemory fails to read the address, it returns 0 (and not nil as before).            
[/list]

[b][size=120]Download:[/size][/b]
[list]
[url=http://gtamp.com/forum/download/file.php?mode=view&id=1815]MISI v0.2b[/url] [color=grey](Windows XP/7/8/10, 32 bit, 7zip, misi_setup.exe)[/color]
[/list]

[b][size=120]Thanks:[/size][/b][list][color=gray]Thank you from me personally as follows
authors and their resources:

Sector for maintaining the game
GTA2 community thanks to him and his comrades people do not forget
about this beautiful game. Also for the useful
Addresses and methods for working with the memory of the game.
http://www.gtamp.com

Vike for patches for the game. Also for the maintenance of the GTA2 community.
http://gtamp.com/forum/viewtopic.php?f=4&t=73

robotanarchy for found and described useful addresses.
https://github.com/Bytewerk/gta2-hackers-remix

Jones for the memory addresses found and published by them.
http://gtamp.com/forum/viewtopic.php?f=4&t=700&start=20#p9357

BeepBoop for found and described useful addresses.
http://gtamp.com/forum/viewtopic.php?f=4&t=1123

Also thank all people who have published useful
materials and took part in discussions with me
at http://www.gtamp.com

Jernej for useful programs
thanks to which I started studying modemaking in GTA2.
http://www.gtatools.com

BenMillard for contribution to the development of modding in GTA2.
For writing tutorials
http://projectcerbera.com

Take-Two Interactive for the creation of a wonderful game GTA2
https://www.take2games.com

Library LUA http://www.lua.org

Inno Setup http://www.jrsoftware.org

Examples of https://www.stackoverflow.com[/color]
[/list]

[size=120][b]How can I help the project?[/b][/size]
[list]
The number of positive reviews depends on the
project development. I will not hide that if MISI
will not be updated for modmeykerov updates
will not be. Also, the library needs useful addresses
to implement full control over the resources of the game
so far there is no possibility of creating new objects,
transport, characters, but if you find the address
(in memory of the game) and tell about the method
I need to initialize/delete new objects
add these functions to the script in the next version and
I will point you out as the author of the method found.

You can
To contribute to the development of MISI by translating the Russian version
Help and documentation in English
(since I do not have the knowledge of the language I use
machine translation). Also the fixes are accepted
Russian grammar and punctuation. Your work will be
accounted and marked in the next release.

If you like this application and you want
support the author so that he can develop it, you can send
he donat.
[/list]

[size=120][b]Donate:[/b][/size]
[list]
WebMoney USD: Z508294826042
PayPal: logofero@gmail.com
[/list]

[size=120][b]Feedback:[/b][/size]
[list]
Email: logofero@gmail.com
[/list]